flatMap

inline fun <A, E, B> Outcome<E, A>.flatMap(f: (A) -> Outcome<E, B>): Outcome<E, B>(source)

FlatMap allows multiple Outcomes to be safely chained together, passing the value from the previous as input into the next function that produces an Outcome

fun <A, E, C> Outcome<E, A>.flatMap(f: (A) -> Outcome<E, C>): Outcome<E, C>
Present(5).flatMap {
if (it < 5) {
Present(it)
} else if (it < 10) {
Absent
} else {
Failure("Value too high")
}
}